package com.ecplatform.common.utils;

public class UserContext {

    private static final ThreadLocal<Long> USER_Id = new ThreadLocal<>();

    /**
     * 设置用户ID
     * @param userId
     */
    public static void setUserId(Long userId) {
        USER_Id.set(userId);
    }

    /**
     * 获取用户ID
     * @return
     */
    public static Long getUserId() {
        return USER_Id.get();
    }

    /**
     * 清除用户ID
     */
    public static void clear() {
        USER_Id.remove();
    }
}
